package thread.matrix;

import thread.matrix.individual.ParalleIndividualMultiplier;
import thread.matrix.single.SerialMultipller;

/**
 * 矩阵中每个元素一个线程：细粒度的算法
 */
public class Test2_ParalleIndividualMultiplier {
    public static void main(String[] args) {
        //生成矩阵
        double[][] matrix1 = MatrixGenerator.genertate(1000,1000);
        double[][] matrix2 = MatrixGenerator.genertate(1000,1000);
        //结果矩阵
        double[][] result = new double[matrix1.length][matrix2[0].length];

        long start,end;
        start = System.currentTimeMillis();

        //计算举证
        ParalleIndividualMultiplier.multiply(matrix1, matrix2, result);

        end = System.currentTimeMillis();
        System.out.println("多线程-元素粒度算法运行时间为："+(end-start)+"ms");//3818ms
    }
}
